package com.hpjpw.idoapp.controller;

import com.hpjpw.ido.domain.Enterprise;
import com.hpjpw.ido.domain.MessageRemind;
import com.hpjpw.ido.service.IMessageRemindService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.SecurityUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @BelongsProject: RuoYi-IDo
 * @BelongsPackage: com.hpjpw.idoapp.controller
 * @Author: hpj
 * @CreateTime: 2021-04-04 22:32
 * @Description: 评论消息提醒
 */
@RestController
@RequestMapping("/ido/app/remind")
public class IDOMessageRemindController extends BaseController {
    @Autowired
    private IMessageRemindService messageRemindService;

    /**
     * 查询评论消息列表
     */
    @GetMapping("/list")
    @ApiOperation("查询评论消息列表，可带分页参数：pageNum=1&pageSize=10")
    public TableDataInfo list() {
        MessageRemind messageRemind_q=new MessageRemind();
        messageRemind_q.setReceiveId(SecurityUtils.getUserId());
        startPage();
        List<MessageRemind> messageReminds = messageRemindService.selectMessageRemindList(messageRemind_q);
        messageRemindService.readMessageRemind(messageRemind_q);
        return getDataTable(messageReminds);
    }

    /**
     * 查询评论消息数量
     */
    @GetMapping("/num")
    @ApiOperation("查询评论消息数量")
    public AjaxResult num() {
        MessageRemind messageRemind_q=new MessageRemind();
        messageRemind_q.setReceiveId(SecurityUtils.getUserId());
        messageRemind_q.setStatus("0");
        int num = messageRemindService.selectCountMessageRemindById(messageRemind_q);
        return AjaxResult.success(num);
    }
}
